<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
	<xsl:param name="ResultsBy" />
	<xsl:param name="ViewByUrl" />
	<xsl:param name="ViewByValue" />
	<xsl:param name="IsNoKeyword" />
	<xsl:param name="IsFixedQuery" />
	<xsl:param name="MoreResultsText" />
	<xsl:param name="MoreResultsLink" />
	<xsl:param name="CollapsingStatusLink" />
	<xsl:param name="CollapseDuplicatesText" />
	<xsl:param name="MeHeaderValue" />
	<xsl:param name="CollHeaderValue" />
	<xsl:param name="CollOfCollHeaderValue" />
	<xsl:param name="EveryoneHeaderValue" />
	<xsl:param name="AddToMyColleaguesText" />
	<xsl:param name="SrchRSSText" />
	<xsl:param name="SrchRSSLink" />
	<xsl:param name="ShowMessage" />
	<xsl:param name="ShowActionLinks" />

	<!-- When there is keywory to issue the search -->
	<xsl:template name="dvt_1.noKeyword">
		<span class="ms-sbplain">
			<xsl:choose>
				<xsl:when test="$IsFixedQuery">
					Please set the 'Fixed Query' property for the webpart.
				</xsl:when>
				<xsl:otherwise>
					Enter one or more words to search for in the search box.
				</xsl:otherwise>
			</xsl:choose>
		</span>
	</xsl:template>


	<!-- When empty result set is returned from search -->
	<xsl:template name="dvt_1.empty">
		<xsl:if test="$ShowActionLinks">
			<div class="srch-sort">
				<xsl:if test="string-length($SrchRSSLink) &gt; 0">
					<a type="application/rss+xml" href ="{$SrchRSSLink}" title="{$SrchRSSText}" id="SRCHRSSL">
						<img border="0" src="/_layouts/images/rss.gif" alt=""/>
						<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
						<xsl:value-of select="$SrchRSSText"/>
					</a>
				</xsl:if>
			</div>
		</xsl:if>
		<br/>
		<br/>

		<span class="ms-sbplain" id="CSR_NO_RESULTS">
			No results matching your search were found.

			<ol>
				<li>Check your spelling. Are the words in your query spelled correctly?</li>
				<li>Try using synonyms. Maybe what you're looking for uses slightly different words.</li>
				<li>Make your search more general. Try more general terms in place of specific ones.</li>
				<li>Try your search in a different scope. Different scopes can have different results.</li>
			</ol>
		</span>
	</xsl:template>


	<!-- Main body template. Sets the Results view (Relevance or date) options -->
	<xsl:template name="dvt_1.body">
		<xsl:if test="$ShowActionLinks">
			<div class="srch-sort">
				<xsl:value-of select="$ResultsBy" />
				<xsl:if test="$ViewByUrl">
					|
					<a href ="{$ViewByUrl}" id="CSR_RV" title="{$ViewByValue}">
						<xsl:value-of select="$ViewByValue" />
					</a>
				</xsl:if>
				<xsl:if test="string-length($SrchRSSLink) &gt; 0">
					|
					<a type="application/rss+xml" href ="{$SrchRSSLink}" title="{$SrchRSSText}" id="SRCHRSSL">
						<img border="0" src="/_layouts/images/rss.gif" alt=""/>
						<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
						<xsl:value-of select="$SrchRSSText"/>
					</a>
				</xsl:if>
			</div>
			<div style="margin-top: 15px;"></div>
			<br />
			<br />
		</xsl:if>

		<xsl:apply-templates />

		<xsl:call-template name="DisplayMoreResultsAnchor" />
	</xsl:template>


	<!-- This template is called for each result -->
	<xsl:template match="All_Results/Result">
		<xsl:variable name="id" select="id"/>
		<xsl:variable name="url" select="url"/>
		<xsl:variable name="email" select="workemail"/>
		<xsl:variable name="sip" select="sipaddress"/>
		<xsl:variable name="prefix">IMNRC('</xsl:variable>
		<xsl:variable name="suffix">')</xsl:variable>
		<table class="psrch-result" CELLPADDING="0" CELLSPACING="0" BORDER="0" width="100%">
			<tr>
				<td class="psrch-imgcell" width="0%">
					<table class="psrch-profimg" CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="77px" HEIGHT="77px">
						<tr>
							<td align="middle" valign="middle">
								<a href="{$url}" id="{concat('CSR_IMGL_',$id)}" title="{$url}">
									<xsl:variable name="imgid" select="concat('CSR_IMG_',$id)"/>
									<xsl:choose>
										<xsl:when test="pictureurl[. != '']">
											<img id="{$imgid}" src="{pictureurl}" alt="{preferredname}" border="0" onload="resizeProfileImage('{$imgid}')"/>
										</xsl:when>
										<xsl:otherwise>
											<img id="{$imgid}" src="/_layouts/images/no_pic.gif" alt="{preferredname}" border="0" onload="resizeProfileImage('{$imgid}')"/>
										</xsl:otherwise>
									</xsl:choose>
									<script>
										window.setTimeout("resizeProfileImage('<xsl:value-of select="$imgid"/>')", 1)
									</script>
								</a>
							</td>
						</tr>
					</table>
				</td>
				<td valign="top" class="psrch-propcell" width="100%">
					<span class="psrch-Title">
						<xsl:choose>
							<xsl:when test="sipaddress[. != '']">
								<img border="0" height="12" width="12" src="/_layouts/images/imnhdr.gif" onload="{concat($prefix, $sip, $suffix)}" ShowOfflinePawn="1" id="{concat('CSRP_',$id,',type=sip')}" />
							</xsl:when>
							<xsl:otherwise>
								<img border="0" height="12" width="12" src="/_layouts/images/imnhdr.gif" onload="{concat($prefix, $email, $suffix)}" ShowOfflinePawn="1" id="{concat('CSRP_',$id,',type=smtp')}" />
							</xsl:otherwise>
						</xsl:choose>
						<a href="{$url}" id="{concat('CSR_',$id)}">
							<xsl:value-of select="preferredname"/>
						</a>
					</span>
					<br/>
					<div class="psrch-Description">
						<xsl:call-template name="DisplayOfficeProfile">
							<xsl:with-param name="title" select="jobtitle" />
							<xsl:with-param name="dep" select="department" />
							<xsl:with-param name="phone" select="workphone" />
							<xsl:with-param name="office" select="officenumber" />
						</xsl:call-template>
					</div>

					<div class="psrch-Description">
						<xsl:choose>
							<xsl:when test="hithighlightedsummary[. != '']">
								<xsl:apply-templates select="hithighlightedsummary" />
								<br/>
							</xsl:when>
							<xsl:when test="aboutme[. != '']">
								<xsl:value-of disable-output-escaping="yes" select="aboutme"/>
								<br/>
							</xsl:when>
						</xsl:choose>
						<xsl:choose>
							<xsl:when test="responsibility[. != ''] or skills[. != '']">
								<xsl:choose>
									<xsl:when test="responsibility[. != '']">
										<span class="psrch-PropLabel">
											<xsl:text>Responsibilities: </xsl:text>
										</span>
										<span class="psrch-PropValue">
											<xsl:value-of select="translate(responsibility,';',',')"/>
											<xsl:text> </xsl:text>
										</span>
									</xsl:when>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="skills[. != '']">
										<xsl:if test="responsibility[. != ''] and skills[. != '']">
											<br/>
										</xsl:if>
										<span class="psrch-PropLabel">
											<xsl:text>Skills: </xsl:text>
										</span>
										<span class="psrch-PropValue">
											<xsl:value-of select="translate(skills,';',',')"/>
										</span>
									</xsl:when>
								</xsl:choose>
								<br/>
							</xsl:when>
							<xsl:otherwise>
								<span />
							</xsl:otherwise>
						</xsl:choose>
					</div>
					<div class="psrch-Description">
						<span class="psrch-Action">
							<xsl:call-template name="DisplaySize">
								<xsl:with-param name="size" select="size" />
							</xsl:call-template>
							<xsl:call-template name="DisplayCollapsingStatusLink">
								<xsl:with-param name="status" select="collapsingstatus"/>
								<xsl:with-param name="url" select="$url"/>
							</xsl:call-template>
							<xsl:choose>
								<xsl:when test="addtomycolleaguesurl[. != '']">
									<xsl:call-template name="DisplayAddToMyColleaguesLink">
										<xsl:with-param name="url" select="addtomycolleaguesurl"/>
									</xsl:call-template>
								</xsl:when>
							</xsl:choose>
						</span>
						<br/>
					</div >
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template name="HitHighlighting">
		<xsl:param name="hh" />
		<xsl:apply-templates select="$hh"/>
	</xsl:template>

	<xsl:template match="ddd">
		&#8230;
	</xsl:template>
	<xsl:template match="c0">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c1">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c2">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c3">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c4">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c5">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c6">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c7">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c8">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="c9">
		<b>
			<xsl:value-of select="."/>
		</b>
	</xsl:template>
	<xsl:template match="All_Results/DummyResult/Me">
		<span class="srch-SocDistTitle">
			<xsl:value-of select="$MeHeaderValue" />
		</span>

	</xsl:template>

	<xsl:template match="All_Results/DummyResult/Colleague">
		<span class="srch-SocDistTitle">
			<xsl:value-of select="$CollHeaderValue" />
		</span>

	</xsl:template>
	<xsl:template match="All_Results/DummyResult/ColleagueOfColleague">
		<span class="srch-SocDistTitle">
			<xsl:value-of select="$CollOfCollHeaderValue" />
		</span>
	</xsl:template>
	<xsl:template match="All_Results/DummyResult/Everyone">
		<span class="srch-SocDistTitle">
			<xsl:value-of select="$EveryoneHeaderValue" />
		</span>
	</xsl:template>

	<!-- The size attribute for each result is prepared here -->
	<xsl:template name="DisplaySize">
		<xsl:param name="size" />
		<xsl:if test='string-length($size) &gt; 0'>
			<xsl:if test="number($size) &gt; 0">
				- <b>
					<xsl:choose>
						<xsl:when test="round($size div 1024) &lt; 1">
							<xsl:value-of select="$size" /> Bytes
						</xsl:when>
						<xsl:when test="round($size div (1024 *1024)) &lt; 1">
							<xsl:value-of select="round($size div 1024)" />KB
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="round($size div (1024 * 1024))"/>MB
						</xsl:otherwise>
					</xsl:choose>
				</b>
			</xsl:if>
		</xsl:if>
	</xsl:template>

	<!-- The "view more results" for fixed query -->
	<xsl:template name="DisplayMoreResultsAnchor">
		<xsl:if test="$MoreResultsLink">
			<a href="{$MoreResultsLink}">
				<xsl:value-of select="$MoreResultsText"/>
			</a>
		</xsl:if>
	</xsl:template>

	<xsl:template name="DisplayAddToMyColleaguesLink">
		<xsl:param name="url"/>
		<a href="{$url}">
			<xsl:value-of select="$AddToMyColleaguesText"/>
		</a>
		<br/>
	</xsl:template>

	<!-- document collapsing link setup -->
	<xsl:template name="DisplayCollapsingStatusLink">
		<xsl:param name="status"/>
		<xsl:param name="url"/>
		<xsl:if test="$CollapsingStatusLink">
			<xsl:choose>
				<xsl:when test="$status=1">
					<br/>
					<xsl:variable name="CollapsingStatusHref" select="concat(substring-before($CollapsingStatusLink, '$$COLLAPSE_PARAM$$'), 'duplicates:&quot;', $url, '&quot;', substring-after($CollapsingStatusLink, '$$COLLAPSE_PARAM$$'))"/>
					[<a href="{$CollapsingStatusHref}" title="{$CollapseDuplicatesText}">
						<xsl:value-of select="$CollapseDuplicatesText"/>
					</a>]
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template>

	<!-- XSL transformation starts here -->
	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="$IsNoKeyword = 'True'" >
				<xsl:call-template name="dvt_1.noKeyword" />
			</xsl:when>
			<xsl:when test="$ShowMessage = 'True'">
				<xsl:call-template name="dvt_1.empty" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="dvt_1.body"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="DisplayOfficeProfile">
		<xsl:param name="title" />
		<xsl:param name="dep" />
		<xsl:param name="phone" />
		<xsl:param name="office" />

		<span class="psrch-Metadata">
			<xsl:if test='string-length($title) &gt; 0'>
				<xsl:value-of select="$title" />
				-
			</xsl:if>
			<xsl:if test='string-length($dep) &gt; 0'>
				<xsl:value-of select="$dep" />
				-
			</xsl:if>
			<xsl:if test='string-length($phone) &gt; 0'>
				<xsl:value-of select="$phone" />
				-
			</xsl:if>
			<xsl:if test='string-length($office) &gt; 0'>
				<xsl:value-of select="$office" />
			</xsl:if>
		</span>
		<br/>
	</xsl:template>

	<!-- End of Stylesheet -->
</xsl:stylesheet>